import requests
import json
if __name__ == '__main__':
    headers = {
        'User-Agent':'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/88.0.4324.104 Safari/537.36'
    }
    url = 'https://movie.douban.com/j/chart/top_list'
    params = {
        'type': '24',
        'interval_id': '100:90',
        'action':'',
        'start': '0',
        'limit': '100'
    }
    response = requests.get(url=url,params=params,headers=headers)
    list_data = response.json()
    f = open('douban.json', 'w', encoding='utf-8')
    json.dump(list_data,f,ensure_ascii=False)
    f.close()
    print('爬取结束！')